Soru & Cevap

Sdcard içindeki Resimleri slaydırda gösterme

27.01.2015 - 10:36

Merhaba 

Aşağıdaki kodları kullanarak slider yaptım , burada URL ve DRAWABLE'dan resimleri alıyor ama ben sdcard içinden almak istiyorum nasıl yapabilirim ?

Teşekkürler. . .

 

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mDemoSlider = (SliderLayout)findViewById(R.id.slider);


HashMap<String,String> url_maps = new HashMap<String, String>();


url_maps.put("Hannibal", "http://static2.hypable.com/wp-content/uploads/2013/12/hannibal-season-2-release-date.jpg");
url_maps.put("Big Bang Theory", "http://tvfiles.alphacoders.com/100/hdclearart-10.png");
url_maps.put("House of Cards", "http://cdn3.nflximg.net/images/3093/2043093.jpg");
url_maps.put("Game of Thrones", "http://images.boomsbeat.com/data/images/full/19640/game-of-thrones-season-4-jpg.jpg");


HashMap<String,Integer> file_maps = new HashMap<String, Integer>();


file_maps.put("Hannibal",R.drawable.hannibal);
file_maps.put("Big Bang Theory",R.drawable.bigbang);
file_maps.put("House of Cards",R.drawable.house);
file_maps.put("Game of Thrones", R.drawable.game_of_thrones);


for(String name : file_maps.keySet()){
TextSliderView textSliderView = new TextSliderView(this);
// initialize a SliderLayout
textSliderView
.description(name)
.image(file_maps.get(name))
.setScaleType(BaseSliderView.ScaleType.Fit)
.setOnSliderClickListener(this);
//add your extra information
textSliderView.getBundle()
.putString("extra",name);
mDemoSlider.addSlider(textSliderView);
}
mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Accordion);
mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
mDemoSlider.setCustomAnimation(new DescriptionAnimation());
mDemoSlider.setDuration(4000);
ListView l = (ListView)findViewById(R.id.transformers);
l.setAdapter(new TransformerAdapter(this));
l.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mDemoSlider.setPresetTransformer(((TextView) view).getText().toString());
Toast.makeText(MainActivity.this, ((TextView) view).getText().toString(), Toast.LENGTH_SHORT).show();
}
});
}

 

8 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

picture-32113-1525245330.jpg
tugbaustundag
27.01.2015 - 03:06

Merhaba,

Bu konuda size yardımcı olacak örnekler:

http://mihaifonoage.blogspot.com.tr/2009/09/displaying-images-from-sd-card-in.html

http://www.androidbegin.com/tutorial/android-display-images-from-sd-card-tutorial/

http://mobile.dzone.com/news/displaying-images-sd-card

http://stackoverflow.com/questions/11740065/how-to-get-image-from-sdcard-in-android

Bu örnekleri uygularsanız sorununuz çözülür